package com.cjl.service.impl;

import com.cjl.entity.EbProduct;
import com.cjl.mapper.ProductMapper;
import com.cjl.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

@Service
public class ProductServiceImpl implements ProductService {

    @Autowired
    private ProductMapper productMapper;
    @Override
    public List<EbProduct> listByPage(Integer page, Integer pageSize) {
        System.out.println("调用了service层");
        int from = (page-1)*pageSize;
        return productMapper.findByPage(from, pageSize);
    }

    @Override
    public Integer findTotalPage(Integer pageSize) {
        return productMapper.getTotalPage(pageSize);
    }

    @Override
    public Integer save(EbProduct ebProduct) {
        return productMapper.save(ebProduct);
    }
    @Override
    public Integer delete(Integer id){
        return productMapper.delete(id);
    }
    @Override
    public EbProduct selectOne(Integer epId){
        return productMapper.selectOne(epId);
    }
    @Override
    public Integer updateById(EbProduct ebProduct){
        return productMapper.updateByPrimaryKey(ebProduct);
    }


}
